package com.atguigu.flink.chapter05.source;


import org.apache.flink.configuration.Configuration;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

import java.util.ArrayList;

/**
 * @author liuyun
 * @title: Flink01_Source_Collection
 * @projectName flink0924
 * @description: TODO
 * @date 2022-3-1 22:05
 */
public class Flink01_Source_Collection {
    public static void main(String[] args) {
        Configuration conf = new Configuration();
        conf.setInteger("rest.port", 2000);
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(conf);

        env.setParallelism(1);

        ArrayList<String> list = new ArrayList<String>();

        list.add("zhangfei");
        list.add("zhaoyun");
        list.add("mayun");

        DataStreamSource<String> stream = env.fromCollection(list);
        stream.print();

        env.fromElements("a", "b", "c", "d").print();
        try {
            env.execute();
        } catch (Exception e) {
            e.printStackTrace();
        }


    }
}
